"use strict";
cc._RF.push(module, '0bd9c1CaQtPhrvO8QHSwIJc', 'Game');
// scripts/Game.js

"use strict";

cc.Class({
  "extends": cc.Component,
  properties: {
    starPrefab: cc.Prefab,
    "long": cc.Prefab,
    maxStarDuration: 0,
    minStarDuration: 0,
    ground: cc.Node,
    player: cc.Node,
    score: cc.Label
  },
  onLoad: function onLoad() {
    this.num = 0;
    this.groundY = this.ground.y + this.ground.height / 2;
    this.spawnNewStar();
    var l = cc.instantiate(this["long"]);
    this.node.addChild(l); // l.setPosition(this.getNewStarPosition());
  },
  spawnNewStar: function spawnNewStar() {
    var newStar = cc.instantiate(this.starPrefab);
    this.node.addChild(newStar);
    newStar.setPosition(this.getNewStarPosition());
    newStar.getComponent('Star').game = this;
  },
  getNewStarPosition: function getNewStarPosition() {
    var randY = this.groundY + Math.random() * this.player.getComponent('Player').jumpHeight + 50;
    var maxX = this.node.width / 2;
    return cc.v2((Math.random() - 0.5) * 2 * maxX, randY);
  },
  start: function start() {}
});

cc._RF.pop();